
package net.swa.dewei.beans.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

/**车型信息维护**/
@Entity
@Table(name = "t_CheXing")
public class CheXing implements Comparable<CheXing>
{
    //PK
    private Long id;

    /**名称**/
    private String name;

    /**车型图片**/
    private String imageUrl;

    /**电池图片缩小版**/
    private String minImageUrl;

    /**车型说明**/
    private String detailInfo;

    /**创建时间**/
    private String crateDate;

    /**更新时间**/
    private String updateDate;

    private Integer sort;

    /**是否已经选择，不做数据库映射**/
    private boolean check;

    /** 车型状态  控制车型是否默认手机端显示 **/
    private String state;

    @GenericGenerator(name = "generator", strategy = "native")
    @Id
    @GeneratedValue(generator = "generator")
    @Column(name = "id", unique = true, nullable = false)
    public Long getId()
    {
        return id;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    @Column(name = "name", length = 255)
    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @Column(name = "imageUrl", length = 500)
    public String getImageUrl()
    {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl)
    {
        this.imageUrl = imageUrl;
    }

    @Column(name = "detailInfo", length = 500)
    public String getDetailInfo()
    {
        return detailInfo;
    }

    public void setDetailInfo(String detailInfo)
    {
        this.detailInfo = detailInfo;
    }

    @Column(name = "crateDate", length = 30)
    public String getCrateDate()
    {
        return crateDate;
    }

    public void setCrateDate(String crateDate)
    {
        this.crateDate = crateDate;
    }

    @Column(name = "updateDate", length = 30)
    public String getUpdateDate()
    {
        return updateDate;
    }

    public void setUpdateDate(String updateDate)
    {
        this.updateDate = updateDate;
    }

    public Integer getSort()
    {
        return sort;
    }

    public void setSort(Integer sort)
    {
        this.sort = sort;
    }

    @Transient
    public boolean isCheck()
    {
        return check;
    }

    public void setCheck(boolean check)
    {
        this.check = check;
    }

    @Override
    public int compareTo(CheXing o)
    {
        if (null == this.sort && null != o.getSort())
        {
            return 1;
        }
        else if (null != this.sort && null == o.getSort())
        {
            return -1;
        }
        else if (null != this.sort && null != o.getSort())
        {
            if (this.sort > o.getSort())
            {
                return 1;
            }
            if (this.sort < o.getSort())
            {
                return -1;
            }
            return 0;
        }
        else
        {
            return 0;
        }
    }

    public String getMinImageUrl()
    {
        return minImageUrl;
    }

    public void setMinImageUrl(String minImageUrl)
    {
        this.minImageUrl = minImageUrl;
    }

    public String getState()
    {
        return state;
    }

    public void setState(String state)
    {
        this.state = state;
    }

}